package com.lei.mq;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2019/2/26.
 */
@Component
public class SimpleConsumer {
    //监听器监听指定的Queue
    @RabbitListener(queues = "simple.queue")
    public void process(String str) {
        System.out.println("message:" + str);
    }
    @RabbitListener(queues = "nmg.statics.queue")
    public void process2(String str) {
        System.out.println("message:" + str);
    }
    @RabbitListener(queues = "expiration.new.queue")
    public void process3(String str) {
        System.out.println("S02ExchannelProducer");
        SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
        System.out.println("message:" + str+"   "+format.format(new Date()));
    }
}
